package test3_25.demo13;

public class Homework14_16 {
    public static String removeRightWhitespace(String s){
        if(s == null || s.isEmpty()){
            return s;
        }

        int index1 = s.length()-1;
        for (int i = s.length()-1; i >= 0 ; i--) {
            if(s.charAt(i) != ' '){
                index1 = i;
                break;
            }
        }

        return s.substring(0,index1+1);
    }


    public static void main(String[] args) {
        System.out.println(Homework14_16.removeRightWhitespace("  e   "));

    }
}
